<?php
class My_Gmailsender{
    
    public static function gsend($gsender,$gpwd,$receiver,$subject,$who,$htmlContent){
        $your_name = $who;
        $your_email = $gsender; //Or your_email@gmail.com for Gmail
        $your_password = $gpwd;
        $send_to_name = '';
        $send_to_email = $receiver;
        
        //SMTP server configuration
        $smtpHost = 'smtp.gmail.com';
        $smtpConf = array(
            'auth' => 'login',
            'ssl' => 'ssl',
            'port' => '465',
            'username' => $your_email,
            'password' => $your_password
        );
        $transport = new Zend_Mail_Transport_Smtp($smtpHost, $smtpConf);

        //Create email
        $mail = new Zend_Mail('UTF-8');                                 
        $mail->setFrom($your_email, $your_name);
        $mail->addTo($send_to_email, $send_to_name);
        $mail->setSubject($subject);
        $mail->setBodyHtml($htmlContent);        
                          
        //Send
        $sent = true;
        try {            
            $mail->send($transport);
        }
        catch (Exception $e) {
            $sent = false;
        }        
    }   
}